package org.imdm.portal.util;

import java.util.Comparator;

public abstract class StringValueComparator implements Comparator<Object> {
	private boolean _asc;
	public StringValueComparator(boolean asc) {_asc = asc;}

	protected abstract String getStringValue(Object o);
	public int compare(Object o1, Object o2) {
		String s1 = getStringValue(o1);
		String s2 = getStringValue(o2);
		int v = s1.compareTo(s2);
		return _asc ? v : -v;
	}
}
